package jvmtest;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: Tom
 * @Date: 2022/02/08/15:53
 * @Description:
 */

/**
 *@ClassName JavaStackOOMDemo
 *@Description
 *@Author 王琛
 *@Date 2022/2/8 15:53
 @Version 1.0
 */
public class JavaStackOOMDemo {
//    public void f(){
//        f();
//    }
    public void f(){
        while (true) {

        }
    }

    public void threadStackOOM() {
        while (true) {
            Thread thread = new Thread(new Runnable() {
                @Override
                public void run() {
                    f();
                }
            });
            thread.start();
        }
    }
    public static void main(String[] args) {
        JavaStackOOMDemo omDemo = new JavaStackOOMDemo();
//        omDemo.f();
        omDemo.threadStackOOM();

    }

}
